#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
char str[maxn];
char p[maxn];
char v[maxn];
int main(void){
   cin.tie(0);std::ios::sync_with_stdio(false);
   LL t;cin>>t;
   while(t--){
       LL len;cin>>len;
       cin>>(str+1);
       LL n=strlen(str+1);
       if((n&1)||(str[1]=='0')||(str[n]=='0')){
          cout<<"NO"<<"\n";
          continue;
       }
       LL cnt=0;
       for(LL i=1;i<=n;i++) if(str[i]=='1') cnt++;
       LL num=1;LL flag=0;
       for(LL i=1;i<=n;i++){
          if(str[i]=='1'&&num<=cnt/2){
             num++;
             v[i]='(';
          }
          else if(str[i]=='1'&&num>cnt/2){
             num++;
             v[i]=')';
          }
          else if(str[i]=='0'&&(!flag)){
             v[i]='(';flag^=1;
          }
          else if(str[i]=='0'&&(flag)){
             v[i]=')';flag^=1;
          }
       }
       for(LL i=1;i<=n;i++){
           if(str[i]=='1') p[i]=v[i];
           else{
              if(v[i]=='(') p[i]=')';
              else if(v[i]==')') p[i]='(';
           }
       }
       stack<char>s;
       for(LL i=1;i<=n;i++){
          if(!s.empty() ){
             if(s.top()=='('&&p[i]==')'){
                s.pop();
             }
             else s.push(p[i]);
          }
          else s.push(p[i]);
       }
       if(!s.empty()){
          cout<<"NO"<<"\n";
       }
       else{
          cout<<"YES"<<"\n";
          for(LL i=1;i<=n;i++){
            cout<<v[i];
          }
          cout<<"\n";
          for(LL i=1;i<=n;i++){
            cout<<p[i];
          }
          cout<<"\n";
       }
   }
   return 0;
}
